<!doctype html> 
<html> 
<head> 
    <meta charset="utf-8"> 
    <title></title> 
    <style type="text/css">
*{margin: 0;padding: 0}

#a{
	width: 100px;height: 100px;background: red;
}
#b{
	width: 100px;height: 100px;background: black;
}

    </style>
</head>
<body>
<div id='a'></div>
<script type="text/javascript">
	

/*
function a(){
	alert(this);
};
new a();
*/

	document.onclick = function(e){
		var ev = e || event;
		var iTarget = ev.srcElement || ev.target//ev.srcElement;


		if(iTarget.id == 'a'){
			//alert(this);
		}

	}
</script>
</body>
</html>